package com.example.springbootactuator;

import com.example.springbootactuator.service.StatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class SpringBootActuatorApplication {

    @Autowired
    private StatusService statusService;

    public static void main(String[] args) {
        SpringApplication.run(SpringBootActuatorApplication.class, args);
    }

    @RequestMapping("/change")
    public String changeStatus(String status) {
        statusService.setStatus(status);
        return "OK";
    }

}
